import {
    createRouter,
    createWebHashHistory
} from "vue-router";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [{
            path: '/login',
            name: 'login',
            meta: {
                keepAlive: true,
                level: 1,
                title: "登陆"
            },
            component: () => import('../pages/login.vue')
        }, {
            path: '/',
            name: 'index',
            meta: {
                keepAlive: true,
                level: 1,
                title: "首页"
            },
            component: () => import('../pages/home.vue')
        }, {
            path: '/details',
            name: 'details',
            meta: {
                keepAlive: true,
                level: 3,
                title: "详情页"
            },
            component: () => import('../pages/details.vue')
        }, {
            path: '/article',
            name: 'article',
            meta: {
                keepAlive: true,
                level: 4,
                title: "内容页"
            },
            component: () => import('../pages/article.vue')
        }, {
            path: '/ucenter',
            name: 'ucenter',
            meta: {
                keepAlive: true,
                level: 9,
                title: "用户中心"
            },
            component: () => import('../pages/ucenter/index.vue')
        }, {
            path: '/ucenter/recharge',
            name: 'recharge',
            meta: {
                keepAlive: true,
                level: 9,
                title: "充值中心"
            },
            component: () => import('../pages/ucenter/recharge.vue')
        }, {
            path: '/ucenter/coupon',
            name: 'coupon',
            meta: {
                keepAlive: true,
                level: 9,
                title: "优惠券"
            },
            component: () => import('../pages/ucenter/coupon.vue')
        }, {
            path: '/ucenter/favorites',
            name: 'favorites',
            meta: {
                keepAlive: true,
                level: 9,
                title: "我的书架"
            },
            component: () => import('../pages/ucenter/favorites.vue')
        }, {
            path: '/ucenter/consume',
            name: 'consume',
            meta: {
                keepAlive: true,
                level: 9,
                title: "消费记录"
            },
            component: () => import('../pages/ucenter/consume.vue')
        }, {
            path: '/ucenter/safety',
            name: 'safety',
            meta: {
                keepAlive: true,
                level: 9,
                title: "安全设置"
            },
            component: () => import('../pages/ucenter/safety.vue')
        }, {
            path: '/ucenter/account',
            name: 'account',
            meta: {
                keepAlive: true,
                level: 9,
                title: "账号设置"
            },
            component: () => import('../pages/ucenter/account.vue')
        }, {
            path: '/ucenter/guide',
            name: 'guide',
            meta: {
                keepAlive: true,
                level: 9,
                title: "常见问题"
            },
            component: () => import('../pages/ucenter/guide.vue')
        }, {
            path: '/search',
            name: 'search',
            meta: {
                keepAlive: true,
                level: 50,
                title: "搜索"
            },
            component: () => import('../pages/search.vue')
        }, {
            path: '/*',
            name: 'error',
            meta: {
                keepAlive: true,
                level: 99,
                title: "错误页"
            },
            component: () => import('../pages/error.vue')
        }
    ]
})

export default router